package com.tanhua.server.controller;


import com.tanhua.domain.vo.LHQuestionnaireVo;
import com.tanhua.server.service.SoulService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/testSoul")
public class SoulController {
    @Autowired
   private  SoulService soulService;

    @GetMapping
   public ResponseEntity findAll(){
       List<LHQuestionnaireVo> lhQuestionnaireVos = soulService.findAll();
//      System.out.println("\033[36;4m" +lhQuestionnaireVos + "\033[0m");
       return  ResponseEntity.ok(lhQuestionnaireVos);
   }
    @PostMapping
    public ResponseEntity testSoul(@RequestBody Map<String,List<Map<String, String>>> answers) {
        List<Map<String, String>> a = answers.get("answers");
        return ResponseEntity.ok(soulService.testSoul(a));
    }

}
